//package com.hutao.medical.controller;
//
//import java.io.File;
//import java.io.IOException;
//import java.io.InputStream;
//import java.net.HttpURLConnection;
//import java.net.URL;
//import java.util.ArrayList;
//import java.util.List;
//
//import org.apache.http.HttpEntity;
//import org.apache.http.HttpResponse;
//import org.apache.http.client.ClientProtocolException;
//import org.apache.http.client.HttpClient;
//import org.apache.http.client.methods.HttpPost;
//import org.apache.http.entity.mime.HttpMultipartMode;
//import org.apache.http.entity.mime.MultipartEntityBuilder;
//import org.apache.http.impl.client.HttpClients;
//
//public class TestUpload {
//
//	public static void main(String[] args) throws ClientProtocolException, IOException {
//		HttpClient client=HttpClients.createDefault();// 开启一个客户端 HTTP 请求 
//		HttpPost post = new HttpPost("http://localhost:8888/upload/tempUploadFile");//创建 HTTP POST 请求  
//		//http://localhost:8090/MrDoc/49557184-0/thumbnail_/09/45/1506050280945/1506050425470.png
//		//http://localhost:8090/MrDoc/49557184-0/thumbnail_/09/45/1506050280945/1506050426814.png
//		MultipartEntityBuilder builder = MultipartEntityBuilder.create();
////				builder.setCharset(Charset.forName("uft-8"));//设置请求的编码格式
//		builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);//设置浏览器兼容模式
//		int count=0;
//		File f =new File("D://test");
//		List<String> urlList=new ArrayList<>();
//		urlList.add("http://pic.58pic.com/58pic/13/76/85/69x58PICm2u_1024.jpg");
//		//urlList.add("http://127.0.0.1:8090/MrDoc/49557184-0/thumbnail_/09/45/1506050280945/1506050426814.png");
//		for (String url:urlList) {
////					FileBody fileBody = new FileBody(file);//把文件转换成流对象FileBody
////					builder.addPart("file"+count, fileBody);
//			InputStream in=getImageFromNetByUrl(url); 
//			builder.addBinaryBody("file"+count, in);
//			count++;
//		}		
//		builder.addTextBody("method", "test");//设置请求参数
//		HttpEntity entity = builder.build();// 生成 HTTP POST 实体  	
//		post.setEntity(entity);//设置请求参数
//		HttpResponse response = client.execute(post);// 发起请求 并返回请求的响应
//		if (response.getStatusLine().getStatusCode()==200) {
//			System.out.println("请求成功!");
//			return;
//		}
//		System.out.println("请求失败!");
//	}
//	
//	 public static InputStream getImageFromNetByUrl(String strUrl){    
//	        try {    
//	            URL url = new URL(strUrl);    
//	            HttpURLConnection conn = (HttpURLConnection) url.openConnection();    
//	           // conn.setRequestMethod("GET");    
//	            conn.setConnectTimeout(5 * 1000);    
//	            InputStream inStream = conn.getInputStream();//通过输入流获取图片数据    
//	            //byte[] btImg = readInputStream(inStream);//得到图片的二进制数据    
//	            return inStream;    
//	        } catch (Exception e) {    
//	            e.printStackTrace();    
//	        }    
//	        return null;    
//	    }    
//}
